package edu.zju.gis.dbfg.server.model;

import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class ExternalDataArgs {
    private String connectionName;
    private String type;
    private String ip;
    private String databaseName;
    private String userName;
    private String password;
    private String port;
    private String dataName;
    private String tableName;
    private String description;
    private String schemaName;
    private String fields;
    private String spatialField;
    private String timeField;
    //    private String timeFileld;
    private String url;
    public ExternalDataArgs fromPgsource( PgSource pgSource){
        this.setDatabaseName(pgSource.getDatabase());
        this.setDataName(pgSource.getDataName());
        this.setIp(pgSource.getIP());
        this.setPort(pgSource.getPort());
        this.setPassword(pgSource.getPassword());
        this.setUserName(pgSource.getUserName());
        this.setTableName(pgSource.getTableName());
        this.setSchemaName(pgSource.getSchemaName());
        this.setSpatialField(pgSource.getSpatialField());
        return this;
    }
    public ExternalDataArgs fromMysqlsource(MysqlSource mysqlSource){
        this.setDatabaseName(mysqlSource.getDatabase());
        this.setDataName(mysqlSource.getDataName());
        this.setIp(mysqlSource.getIP());
        this.setPort(mysqlSource.getPort());
        this.setPassword(mysqlSource.getPassword());
        this.setUserName(mysqlSource.getUserName());
        this.setTableName(mysqlSource.getTableName());
        this.setSpatialField(mysqlSource.getSpatialField());
        return this;
    }
}
